package com.gexiaobao.pigeon.ui.adapter

import androidx.appcompat.widget.AppCompatImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.HotGoodsResponse
import com.gexiaobao.pigeon.app.util.ImageLoaderManager
import com.gexiaobao.pigeon.databinding.ItemHotGoodsBinding

/**
 * @Author      : hxw
 * @Date        : 2024/1/29 15:24
 * @Describe    :
 */
class HotGoodsAdapter(data: ArrayList<HotGoodsResponse.ListBean>) :
    BaseQuickAdapter<HotGoodsResponse.ListBean, DataBindBaseViewHolder>(R.layout.item_hot_goods, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: HotGoodsResponse.ListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemHotGoodsBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动
        val ivItemHotImage = holder.getView<AppCompatImageView>(R.id.ivItemHotImage)
        ImageLoaderManager.loadRoundImageTopOrEmpty(context, item.imagePath, ivItemHotImage, 20, R.drawable.shop_product_def)
    }

}